package com.vincent.template.commons.validation.constraints;

import com.vincent.template.commons.validation.validators.MatchYmValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @Author Vincent Wang
 * @Date 2020/9/9 20:45
 */
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {MatchYmValidator.class})
public @interface MatchYM {

    boolean required() default true;

    String message() default "格式必须为yyyy-MM";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
